November 5th 2020
Assumed Workshop Prerequisites
General Workshop Info
If we denote the R experience levels c(0, 1, 2, 3), then the average is 1.8
A participant who has met the objectives of this workshop will be able to:
The aim of this workshop is to introduce you to artificial neural networks in R
The key here being introduce, we have limited time, so you will mainly be working with code I created
We have 4h in total, realistically we can only scratch the surface of deep learning
If you have little-to-no-experience with base R and/or Tidyverse, expect the workshop to feel overwhelming
Workshop materials will remain open, so my intention is, that you can revisit and study them further after todays workshop
Leon Eyrich Jessen
I’m from Copenhagen, Denmark
Background in biotech engineering and a PhD in Bioinformatics
I am an Assistant Professor of Bioinformatics at Department of Health Technology, Technical University of Denmark
Head of the BioMLgroup focusing on development and application of machine learning in bioinformatics
If you are interested in bioinformatics, machine learning and data science, feel free to find me on Twitter: @jessenleon
Source: Bruce Blaus | Multipolar Neuron | CC BY 3.0
To put it simple, the input vector I is transformed to a prediction O
The input vector is simply the set of variables in your data for a single observation, e.g.
## # A tibble: 10 x 5 ## Sepal.Length Sepal.Width Petal.Length Petal.Width Species ## <dbl> <dbl> <dbl> <dbl> <fct> ## 1 6.5 3 5.8 2.2 virginica ## 2 5 3 1.6 0.2 setosa ## 3 6.7 3.3 5.7 2.5 virginica ## 4 4.8 3.4 1.9 0.2 setosa ## 5 6.1 2.8 4 1.3 versicolor ## 6 6.8 3 5.5 2.1 virginica ## 7 6.4 3.2 5.3 2.3 virginica ## 8 5 3.3 1.4 0.2 setosa ## 9 4.5 2.3 1.3 0.3 setosa ## 10 7.9 3.8 6.4 2 virginica
\(Species \sim f(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)\)
We can visualise this like so
I is the input vector, H is the hidden layer and O is the outputB is the bias neuron, think intercept in the familiar \(y = b + a \cdot x\)Flow from input layer (features) to hidden layer:
\(H_{j} = I_{i} \cdot v_{i,j} + I_{i+1} \cdot v_{i+1,j} + I_{i+...} \cdot v_{i+...,j} + I_{n} \cdot v_{n,j} + B_{I} \cdot v_{n+1,j} =\) \(\sum_{i}^{n} I_{i} \cdot v_{i,j} + B_{I} \cdot v_{n+1,j} = \sum_{i}^{n+1} I_{i} \cdot v_{i,j} = \textbf{I} \cdot \textbf{v}_j\)
Non-linear transformation of hidden layer input to hidden layer output (activation function):
\(S(H_{j}) = \frac{1}{1+e^{-H_{j}}}\)
Flow from hidden layer to output layer:
\(O = H_{j} \cdot w_{j} + H_{j+1} \cdot w_{j+1} + H_{j+...} \cdot w_{j+...} + H_{m} \cdot w_{m} + B_{H} \cdot w_{m+1} =\) \(\sum_{j}^{m} H_{j} \cdot w_{j} + B_{H} \cdot w_{m+1} = \sum_{j}^{m+1} H_{j} \cdot w_{j} = \textbf{H} \cdot \textbf{w}\)
Non-linear transformation of output layer input to output layer output (activation function):
\(S(O) = \frac{1}{1+e^{-O}}\)
Choice of activation function for output neuron(s) depend on aim
Please proceed to the exercise on prototyping an ANN
At the exercises, I will strongly advice to pair up two-and-two, so you can discuss
Internalising knowledge is much more effecient, when you are forced to put concepts into words
GitHub repo for this workshop is: https://github.com/leonjessen/RPharma2020